home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / qgpgme / dataprovider.h next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  1.8 KB  |  63 lines

  1. /* dataprovider.h
  2.    Copyright (C) 2004 KlarΣlvdalens Datakonsult AB
  3.  
  4.    This file is part of QGPGME.
  5.  
  6.    QGPGME is free software; you can redistribute it and/or modify it
  7.    under the terms of the GNU General Public License as published by
  8.    the Free Software Foundation; either version 2 of the License, or
  9.    (at your option) any later version.
  10.  
  11.    QGPGME is distributed in the hope that it will be useful, but
  12.    WITHOUT ANY WARRANTY; without even the implied warranty of
  13.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.    General Public License for more details.
  15.  
  16.    You should have received a copy of the GNU General Public License
  17.    along with QGPGME; if not, write to the Free Software Foundation,
  18.    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.  */
  19.  
  20. // -*- c++ -*-
  21. #ifndef __QGPGME_DATAPROVIDER_H__
  22. #define __QGPGME_DATAPROVIDER_H__
  23.  
  24. #include <gpgmepp/interfaces/dataprovider.h>
  25.  
  26. #include <qcstring.h>
  27. #include <kdepimmacros.h>
  28.  
  29. namespace QGpgME {
  30.  
  31.   class KDE_EXPORT QByteArrayDataProvider : public GpgME::DataProvider {
  32.   public:
  33.     QByteArrayDataProvider();
  34.     QByteArrayDataProvider( const QByteArray & initialData );
  35.     ~QByteArrayDataProvider();
  36.  
  37.     const QByteArray & data() const { return mArray; }
  38.  
  39.   private:
  40.     // these shall only be accessed through the dataprovider
  41.     // interface, where they're public:
  42.     /*! \reimp */
  43.     bool isSupported( Operation ) const { return true; }
  44.     /*! \reimp */
  45.     ssize_t read( void * buffer, size_t bufSize );
  46.     /*! \reimp */
  47.     ssize_t write( const void * buffer, size_t bufSize );
  48.     /*! \reimp */
  49.     off_t seek( off_t offset, int whence );
  50.     /*! \reimp */
  51.     void release();
  52.  
  53.   private:
  54.     QByteArray mArray;
  55.     off_t mOff;
  56.   };
  57.  
  58. } // namespace QGpgME
  59.  
  60. #endif // __QGPGME_EVENTLOOPINTERACTOR_H__
  61.  
  62.  
  63.